#include <iostream>

using namespace std;

const int MOD = 998244353, seed = 233;

const int N = 1000005;

int h[N], qp[N];
int th[N];

void init_hash(string s)
{
  qp[0] = 1;
  h[0] = s[0] % MOD;
  for (int i = 1; i < s.size(); ++i)
  {
    h[i] = (1ll * h[i - 1] * seed % MOD + s[i]) % MOD;
    qp[i] = 1ll * qp[i - 1] * seed % MOD;
  }
}

int get_hash(int l, int r)
{
  if (l == 0)
    return h[r];
  return (h[r] + MOD - 1ll * h[l - 1] * qp[r - l + 1] % MOD) % MOD;
}

string s, T;

int main()
{
  cin >> s;
  cin >> T;
  init_hash(s);
  th[0] = T[0] % MOD;
  for (int i = 1; i < T.size(); ++i)
  {
    th[i] = (1ll * th[i - 1] * seed + T[i]) % MOD;
  }
  int ans = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    int l = 1, r = min(T.size(), s.size() - i), mid;
    while (l <= r)
    {
      mid = (l + r) / 2;
      if (get_hash(i, i + mid - 1) == th[mid - 1])
      {
        ans = max(ans, mid);
        l = mid + 1;
      }
      else
      {
        r = mid - 1;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}